package com.software.backend.indexshow.service;


import com.software.backend.indexshow.entity.Post;
import com.software.backend.indexshow.repository.PostInfoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

/**
 * @author Charon
 * @version 1.0
 * @date 2022/12/24 15:23
 */
@Service
public class PostInfoServiceImpl implements PostInfoService{

    @Autowired
    private PostInfoRepository postInfoRepository;

    @Override
    public Page<Post> findPostInfo(Integer page, Integer size) {
        Pageable pageable = PageRequest.of(page, size);
        Page<Post> postPage = postInfoRepository.findAll(pageable);
        return postPage;
    }
}
